<?php
session_start();
//если не админ - редирект на главнаю
if($_SESSION['role'] != 'Admin' and $_SESSION['role'] != 'Moderator'){      
    header("location: /../index.php");
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="language" content="en" />
<link rel="stylesheet" type="text/css" href="css/admin.css" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript" src="/../ckeditor/ckeditor.js"></script>
</head>
<body>
<div id="container">

<!--HEADER -->
  <div id="header"> 
    
<!--MAIN MENU -->    
  <div id="main_menu">
      <ul>
        <li><a href="categories.php?list">Категории</a></li>  
        <li><a href="posts.php?list">Посты</a></li> 
        <li><a href="comments.php?list">Комментарии</a></li>    
        <li><a href="users.php?list">Пользователи</a></li>
        <li><a href="/../index.php">Выйти</a></li>
      </ul>
    </div>
<!--END MAIN MENU -->
    
  </div>
<!--END HEADER --> 
 
  <div id="left_side">
    <div id="left_menu">
      <ul>
        <li><a href="posts.php?list">Посмотреть список</a></li>    
        <li><a href="posts.php?add">Добавить</a></li>
      </ul>      
    </div>       
  </div>
  <div id="content">
  <?php
  if(isset($_POST['start'])){
    require_once dirname(__FILE__)."/../main/sort/admin/posts/sort.php";
  }
  ?>
  <!-- СОРТИРОВКА -->
<?php if(isset($_GET['list'])){ ?>
  <div class="left">
  <form action="posts.php?sort" method="post">
    Сортировать по:
    <select name = "sort">
      <option value="id">ID</option>
      <option value="date_create">Дате создания</option>
      <option value="name">По имени</option>
    </select>
    <input type="submit" name="start" value="Sort">
  </form>  
  </div>  <?php } ?>  
<?php
if(isset($_GET['list'])){
    require_once dirname(__FILE__)."/posts/list/posts_view.php";
}
if(isset($_GET['add'])){
    require_once dirname(__FILE__)."/posts/add/posts_add.php";
}
if(isset($_GET['del'])){
    require_once dirname(__FILE__)."/posts/delete/posts_delete.php";
}

if(isset($_GET['update'])){
    require_once dirname(__FILE__)."/posts/update/posts_update.php";
}
if(isset($_GET['sort'])){
    require_once dirname(__FILE__)."/posts/list/sort_view.php";
}
?>
      <?php
      if(isset($_GET['list'])){ 
          require_once dirname(__FILE__)."/../main/pagination/admin/posts/pagination_show.php";
      }    
      ?>
  </div>
    
<!--PAGINATION -->    
    <div id="pagination">

    </div>
<!--END PAGINATION -->
    
</div>

</body>
</html>
